﻿/*
 * Returns a new time using a specified datetime.
 */
create function [Time].[FromDateTime] ( @p_DateTime datetime )
returns time as
begin

  return DateAdd( Day, -DateDiff( Day, 0, @p_DateTime ), @p_DateTime );

end